function getUrl(last) {
   var host = 'yyja.maksdu.com';
   return 'https://'+host+'/'+last;
}
function save() {
	var name = $("#departmentName").val();
	if(name.trim().length<2) {
		alert("部门名称至少超过两个汉字");
		return;
	}
	$.ajax({
		url:getUrl('department/save'),
		type: 'post',
		data: {
			departmentName: name,
		},
		success: function(data) {
			if(data) {
				window.location.reload();
			}
		}
	})
}

function users() {
	$.ajax({
		url:getUrl('admin/users'),
		method:'get',
		data:{
			pageNo:0,
			size:100
		},
		success:function(data) {
			if(data) {

			}
		}
	});
}

function DeleteByIds(ids) {
	$.ajax({
		url:getUrl('department/delete'),
		type: 'post',
		data: {
			id: ids
		},
		success:function(data) {
			console.info(data);
			if(data) {
				window.location.reload();
			}
		}
	});
}

function getAllUser() {
	
}

function add0(m){return m<10?'0'+m:m }  

function changeDateFormat(cellval) {  
    if (cellval != null) {  
        var time = new Date(cellval);  
	    var year = time.getFullYear();  
	    var month = time.getMonth()+1;  
	    var date = time.getDate();  
	    var hours = time.getHours();  
	    var minutes = time.getMinutes();  
	    var seconds = time.getSeconds();  
	    return year+'-'+add0(month)+'-'+add0(date)+' '+add0(hours)+':'+add0(minutes)+':'+add0(seconds);
    }  
}  
